package com.luhuiguo.cms.client.ui;

import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.luhuiguo.cms.client.GlobalConstants;
import com.luhuiguo.cms.client.GlobalMessages;
import com.luhuiguo.cms.client.presenter.AppPresenter;

/**
 * 应用视图。
 * 
 * @author LuHuiguo
 * @version $Id: AppView.java 187 2010-05-30 15:39:22Z luhuiguo@gmail.com $
 */
@Singleton
public class AppView extends Viewport implements AppPresenter.Display {

    @SuppressWarnings("unused")
    private GlobalConstants constants;

    @SuppressWarnings("unused")
    private GlobalMessages messages;

    @Inject
    public AppView(GlobalConstants constants, GlobalMessages messages, HeaderView headerView,
            NavigationView navigationView, MainView mainView) {
        super();

        this.constants = constants;
        this.messages = messages;

        this.setLayout(new BorderLayout());

        BorderLayoutData data = new BorderLayoutData(LayoutRegion.NORTH, 33);
        data.setMargins(new Margins());
        this.add(headerView, data);

        data = new BorderLayoutData(LayoutRegion.WEST, 200, 150, 350);
        data.setMargins(new Margins(5, 0, 5, 5));
        data.setCollapsible(true);
        this.add(navigationView, data);
        data = new BorderLayoutData(LayoutRegion.CENTER);
        data.setMargins(new Margins(5, 5, 5, 5));

        this.add(mainView, data);

    }

    @Override
    public void addWidget(Widget widget) {

    }

    @Override
    public void removeWidget(Widget widget) {

    }

    @Override
    public void showWidget(Widget widget) {

    }

    @Override
    public Widget asWidget() {
        return this;
    }

}
